function C57_Midazolam_PV_Bar_Plot(Data_Summary)
%% collect C6 saline PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_6') && strcmp(Data_Summary(n).drug, "saline")
        C6_Saline(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C6_Saline(C6_Saline==0)=[];

%% collect C6 MIDA 0.25mg/kg PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_6') && strcmp(Data_Summary(n).drug, "midazolam 0.25mg/kg")
        C6_MIDA025(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C6_MIDA025(C6_MIDA025==0)=[];

%% collect C6 MIDA 1.25mg/kg PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_6') && strcmp(Data_Summary(n).drug, "midazolam 1.25mg/kg")
        C6_MIDA125(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C6_MIDA125(C6_MIDA125==0)=[];

%% collect C6 MIDA 2.5mg/kg PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_6') && strcmp(Data_Summary(n).drug, "midazolam 2.5mg/kg")
        C6_MIDA25(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C6_MIDA25(C6_MIDA25==0)=[];

%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%

%% collect C7 saline PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_7') && strcmp(Data_Summary(n).drug, "saline")
        C7_Saline(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C7_Saline(C7_Saline==0)=[];

%% collect C7 MIDA 0.25mg/kg PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_7') && strcmp(Data_Summary(n).drug, "midazolam 0.25mg/kg")
        C7_MIDA025(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C7_MIDA025(C7_MIDA025==0)=[];

%% collect C7 MIDA 1.25mg/kg PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_7') && strcmp(Data_Summary(n).drug, "midazolam 1.25mg/kg")
        C7_MIDA125(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C7_MIDA125(C7_MIDA125==0)=[];

%% collect C7 MIDA 2.5mg/kg PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_7') && strcmp(Data_Summary(n).drug, "midazolam 2.5mg/kg")
        C7_MIDA25(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C7_MIDA25(C7_MIDA25==0)=[];

%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%

%% collect C8 saline PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_8') && strcmp(Data_Summary(n).drug, "saline")
        C8_Saline(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C8_Saline(C8_Saline==0)=[];

%% collect C8 MIDA 0.25mg/kg PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_8') && strcmp(Data_Summary(n).drug, "midazolam 0.25mg/kg")
        C8_MIDA025(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C8_MIDA025(C8_MIDA025==0)=[];

%% collect C8 MIDA 1.25mg/kg PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_8') && strcmp(Data_Summary(n).drug, "midazolam 1.25mg/kg")
        C8_MIDA125(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C8_MIDA125(C8_MIDA125==0)=[];

%% collect C8 MIDA 2.5mg/kg PV
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'C57_8') && strcmp(Data_Summary(n).drug, "midazolam 2.5mg/kg")
        C8_MIDA25(n,1)=Data_Summary(n).PV_Corr_Memory_Index;
    end
end
C8_MIDA25(C8_MIDA25==0)=[];

%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%

%% plotting & data organization

Saline_Summary=cat(1,C6_Saline,C7_Saline,C8_Saline);
MIDA025_Summary=cat(1,C6_MIDA025,C7_MIDA025,C8_MIDA025);
MIDA125_Summary=cat(1,C6_MIDA125,C7_MIDA125,C8_MIDA125);
MIDA25_Summary=cat(1,C6_MIDA25,C7_MIDA25,C8_MIDA25);

figure
A = categorical({'Saline'});
B = categorical({'0.25'});
C = categorical({'1.25'});
D = categorical({'2.5'});
X = cat(2,A,B,C,D);
X = reordercats(X,{'Saline','0.25','1.25','2.5'});
Y(1,1) = mean(Saline_Summary(:),'omitnan');
Y(1,2) = mean(MIDA025_Summary(:),'omitnan');
Y(1,3) = mean(MIDA125_Summary(:),'omitnan');
Y(1,4) = mean(MIDA25_Summary(:),'omitnan');
h=bar(X(1,1),Y(1,1),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.5);
h.CData(1,:) = [0 0 1]; % color up each individual bar
ylabel('PV Correlation');
xlabel('Midazolam Dose (mg/kg)');
hold on
h=bar(X(1,2),Y(1,2),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.2);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,3),Y(1,3),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.4);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,4),Y(1,4),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.6);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
err(1,1)=calculate_standard_error(Saline_Summary(:,1));
err(1,2)=calculate_standard_error(MIDA025_Summary(:,1));
err(1,3)=calculate_standard_error(MIDA125_Summary(:,1));
err(1,4)=calculate_standard_error(MIDA25_Summary(:,1));
er = errorbar(X,Y,[],err,'LineWidth',2);    
er.Color = [0 0 0];                            
er.LineStyle = 'None'; 
ylim([0,0.7]);
set(gca,'FontSize',15);
hold on

% scatter plots with horizontal offsets - quick & dirty
half_num_animals_in_plot = 1.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(A,size(C6_Saline,1),1),C6_Saline(:,1),70,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(C7_Saline,1),1),C7_Saline(:,1),70,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(A,size(C8_Saline,1),1),C8_Saline(:,1),70,'o','m','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 1.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(B,size(C6_MIDA025,1),1),C6_MIDA025(:,1),70,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(C7_MIDA025,1),1),C7_MIDA025(:,1),70,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(B,size(C8_MIDA025,1),1),C8_MIDA025(:,1),70,'o','m','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


half_num_animals_in_plot = 1.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(C,size(C6_MIDA125,1),1),C6_MIDA125(:,1),70,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(C7_MIDA125,1),1),C7_MIDA125(:,1),70,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(C,size(C8_MIDA125,1),1),C8_MIDA125(:,1),70,'o','m','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;



half_num_animals_in_plot = 1.5;
initial_offset = -0.3;
offset = initial_offset;

sh = scatter(repmat(D,size(C6_MIDA25,1),1),C6_MIDA25(:,1),70,'o','k','LineWidth',2);
offset = offset - (initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(C7_MIDA25,1),1),C7_MIDA25(:,1),70,'o','b','LineWidth',2);
offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;

sh = scatter(repmat(D,size(C8_MIDA25,1),1),C8_MIDA25(:,1),70,'o','m','LineWidth',2);
offset = offset - 0.5*(initial_offset/half_num_animals_in_plot);
sh.XData = double(sh.XData) + offset;


hold off

end